package com.ruoyi.personnel.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.personnel.domain.Enclosure;
import com.ruoyi.personnel.mapper.EnclosureMapper;
import com.ruoyi.personnel.service.IEnclosureService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 护士职业资格管理Service业务层处理
 *
 * @author ruoyi
 * @date 2021-03-01
 */
@Service
public class EnclosureServiceImpl extends ServiceImpl<EnclosureMapper, Enclosure> implements IEnclosureService {

    @Override
    public List<Enclosure> queryList(Enclosure enclosure) {
        LambdaQueryWrapper<Enclosure> lqw = Wrappers.lambdaQuery();
        if (StringUtils.isNotBlank(enclosure.getName())){
            lqw.like(Enclosure::getName ,enclosure.getName());
        }
        if (StringUtils.isNotBlank(enclosure.getJobNumber())){
            lqw.eq(Enclosure::getJobNumber ,enclosure.getJobNumber());
        }
        if (StringUtils.isNotBlank(enclosure.getPersonnelId())){
            lqw.eq(Enclosure::getPersonnelId ,enclosure.getPersonnelId());
        }
        if (StringUtils.isNotBlank(enclosure.getLicenseApprovalTime())){
            lqw.eq(Enclosure::getLicenseApprovalTime ,enclosure.getLicenseApprovalTime());
        }
        if (StringUtils.isNotBlank(enclosure.getLicenseNo())){
            lqw.eq(Enclosure::getLicenseNo ,enclosure.getLicenseNo());
        }
        if (StringUtils.isNotBlank(enclosure.getEffectiveTime())){
            lqw.eq(Enclosure::getEffectiveTime ,enclosure.getEffectiveTime());
        }
        if (StringUtils.isNotBlank(enclosure.getEnclosure())){
            lqw.eq(Enclosure::getEnclosure ,enclosure.getEnclosure());
        }
        if (StringUtils.isNotBlank(enclosure.getEnclosureName())){
            lqw.like(Enclosure::getEnclosureName ,enclosure.getEnclosureName());
        }
        if (StringUtils.isNotBlank(enclosure.getStatus())){
            lqw.eq(Enclosure::getStatus ,enclosure.getStatus());
        }
        return this.list(lqw);
    }
}
